﻿
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Text;
using Microsoft.Practices.Repository;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DotNetCore.BannerManagement.Domain;
using System.Data.SqlClient; 

namespace DotNetCore.BannerManagement.DAL.Domain.dnc_ZoneRepositoryArtifacts
{
    /// <summary>
    /// Construct a List<dnc_Zone> collection from an IDataReader object.
    /// </summary>
    internal class GetAllFromdnc_ZoneFactory : IDomainObjectFactory<dnc_Zone>
    {        
        public List<dnc_Zone> Construct(IDataReader reader)
        {
			List<dnc_Zone> dnc_ZoneList = new List<dnc_Zone>();

            // Process first cursor
			while (reader.Read())
            {
                dnc_Zone dnc_Zone = new dnc_Zone();                		    
			int iDIndex = reader.GetOrdinal("ID"); 
            if(!reader.IsDBNull(iDIndex))
            {
                dnc_Zone.ID= reader.GetInt32(iDIndex);

			}
			int nameIndex = reader.GetOrdinal("Name"); 
            if(!reader.IsDBNull(nameIndex))
            {
                dnc_Zone.Name= reader.GetString(nameIndex);

			}
			int zoneImageIdIndex = reader.GetOrdinal("ZoneImageId"); 
            if(!reader.IsDBNull(zoneImageIdIndex))
            {
                dnc_Zone.ZoneImageId= reader.GetInt32(zoneImageIdIndex);

			}
          
        dnc_ZoneList.Add(dnc_Zone);
        }

			return dnc_ZoneList; 
        }



        #region IDomainObjectFactory<dnc_Zone> Members

        dnc_Zone IDomainObjectFactory<dnc_Zone>.Construct(IDataReader reader)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}

